<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */

$query = Registry::get('db')->query("SELECT * FROM {prefix}articles ORDER BY date DESC LIMIT 10");

while($data = $query->fetch_array()){
        echo '<tr><td>'.$data['title'].'</td>';
	echo '<td>'.User::getDisplayName($data['author_id']).'</td>';
	echo '<td>'.getCategoryName($data['cat_id']).'</td>';
	$count_comment = $GLOBALS['db']->query("SELECT COUNT(id) AS result FROM {prefix}comments WHERE article_id = '".$data['id']."'");
	$count_comment = $count_comment->fetch_array();
	echo '<td>'.$count_comment['result'].'x</td>';
	echo '<td><a href="index.php?p=components&name=content&a=edit&id='.$data['id'].'"><img src="../libs/icons/page_white_edit.png" /></a><a href="index.php?p=components&name=content&a=delete&id='.$data['id'].'"><img src="../libs/icons/page_white_delete.png" /></a></td></tr>';
}
?>